@charset "utf-8";
.my-select {
    display: block;
    position: relative;
    width: 200px;
    font-size: 14px;
    z-index: 100;

    * {
        box-sizing: border-box;
    }

    &-selection, &-selection_choice, &-dropdown-menu {
        width: 100%;
    }

    &-icon {
        position: absolute;
        top: 0;
        right: 0;
        line-height: 34px;

        > * {
            line-height: 34px;
        }

        &:last-child {
            margin-right: 4px;
        }
    }

    &-selection {
        // 已选项
        &_choice {
            height: 34px;
            line-height: 34px;
            padding: 0 24px 0 8px;
            border: 1px solid rgb(217, 217, 217);
            border-radius: 2px;
            background-color: #fff;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;

            &:hover {
                background-color: #e6e6e6;
            }

            /*删除图标*/
            &_remove {
                position: relative;
                display: none;
                width: 1em;
                height: 1em;
                cursor: pointer;
                &:hover {
                    .my-select-selection_choice_remove {
                        display: inline-block;
                        &:before, &:after{
                            content: '';
                            position: absolute;
                            top: .1em;
                            left: -.2em;
                            width: 1px;
                            height: 1em;
                            background: rgb(51, 51, 51);
                        }
                        &:after {
                            transform: rotate(45deg);
                        }
                        &:before {
                            transform: rotate(-45deg);
                        }
                    }
                }
            }
        }

    }

    /*下拉箭头*/
    &-arrow-icon_pull-down {
        cursor: pointer;
        display: inline-block;
        width: 0.7em;
        height: 0.7em;
        border-left: 1px solid rgb(51, 51, 51);
        border-bottom: 1px solid rgb(51, 51, 51);
        transform: rotate(-45deg) translateY(-0.3em);
    }
    // 下拉选项
    &-dropdown-menu {
        position: absolute;
        display: none;
        max-height: 200px;
        overflow-y: auto;
        margin: 0;
        padding: 0;
        border: 1px solid rgba(0, 0, 0, .15);
        border-radius: 4px;
        background: white;
        box-shadow: 0 6px 12px rgba(0, 0, 0, .175);

        &-search {
            width: 100%;
            margin: 10px 0;
            padding: 0 10px;
            &-box {
                width: 100%;
                height: 28px;
                padding: 0 8px;
                line-height: 28px;
                border: 1px solid rgb(217, 217, 217);
                border-radius: 2px;
            }
        }

        &-item {
            width: 100%;
            margin: 4px 0;
            list-style: none;
            &:hover {
                background: #EEE;
            }
            &_render {
                display: flex;
                width: 100%;
                padding: 4px 10px;
                align-items: center;
                &-icon {
                    border: 1px solid limegreen;
                    border-radius: 2px;
                    display: inline-block;
                    width: 1.2em;
                    height: 1.2em;
                    &-wrapper {
                        display: flex;
                        align-items: center;
                        position: relative;
                        margin-right: 4px;
                    }
                    &.checked {
                        border: transparent;
                        background: limegreen;
                        &:before {
                            content: '';
                            display: block;
                            width: 68%;
                            height: 31%;
                            margin: 20% auto;
                            border-left: 2px solid white;
                            border-bottom: 2px solid white;
                            transform: rotate(-45deg);
                        }
                    }
                }
            }
        }

        &.single {
            .my-select-dropdown-menu-item_render-icon {
                border: none;
                .checked {
                    background: none;
                    &:before {
                        border-left: 2px solid limegreen;
                        border-bottom: 2px solid limegreen;
                    }
                }
            }
        }

        &-item-text {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }

    &.open > &-dropdown-menu {
        display: block;
    }
}